package com.ternnetwork.oa.repository.note;


import com.ternnetwork.persistence.repository.BaseRepository;
import com.ternnetwork.oa.entity.note.Note;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface NoteRepository extends BaseRepository<Note, Long> {

    @Modifying
    @Query("update  Note t set t.category=null where t.category.id=?1")
    Integer updateByDeleteCategory(Long categoryId);

    @Query("from Note t where t.shareCode=?1 ")
    List<Note> findAllByShareCode(String shareCode);


    @Query("select count(1) from Note where createdById=?1")
    Long getCount(Long createdById);

}
